{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "a640086e",
   "metadata": {},
   "source": [
    "These pip installs need to be adapted to use the appropriate release level. Alternatively, The venv running the jupyter lab could be pre-configured with a requirement file that includes the right release. Example for transform developers working from git clone:\n",
    "\n",
    "    make venv \n",
    "    source venv/bin/activate \n",
    "    pip install jupyterlab\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b2edb3bb",
   "metadata": {},
   "outputs": [],
   "source": [
    "%%capture\n",
    "## This is here as a reference only\n",
    "# Users and application developers must use the right tag for the latest from pypi\n",
    "%pip install data-prep-toolkit\n",
    "%pip install data-prep-toolkit-transforms[license_select]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7be2ad4e",
   "metadata": {},
   "outputs": [],
   "source": [
    "from dpk_license_select import LicenseSelect"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "4783b780-ab14-4856-940d-5a79d657bd1e",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "15:38:17 INFO - data factory lc_ is using local configuration without input/output path\n",
      "15:38:17 INFO - data factory lc_ max_files -1, n_sample -1\n",
      "15:38:17 INFO - data factory lc_ Not using data sets, checkpointing False, max files -1, random samples -1, files to use ['.parquet'], files to checkpoint ['.parquet']\n",
      "15:38:17 INFO - Getting supported licenses from file /Users/shivdeep/workspace/projects/current/dpk-newapi/transforms/code/license_select/test-data/sample_approved_licenses.json\n",
      "15:38:17 INFO - Read a list of 171 licenses.\n",
      "15:38:17 INFO - pipeline id pipeline_id\n",
      "15:38:17 INFO - job details {'job category': 'preprocessing', 'job name': 'license_select', 'job type': 'pure python', 'job id': 'job_id'}\n",
      "15:38:17 INFO - code location None\n",
      "15:38:17 INFO - data factory data_ is using local data access: input_folder - ./test-data/input output_folder - output\n",
      "15:38:17 INFO - data factory data_ max_files -1, n_sample -1\n",
      "15:38:17 INFO - data factory data_ Not using data sets, checkpointing False, max files -1, random samples -1, files to use ['.parquet'], files to checkpoint ['.parquet']\n",
      "15:38:17 INFO - orchestrator license_select started at 2025-02-13 15:38:17\n",
      "15:38:17 INFO - Number of files is 2, source profile {'max_file_size': 0.0034952163696289062, 'min_file_size': 0.0031719207763671875, 'total_file_size': 0.006667137145996094}\n",
      "15:38:17 INFO - Completed 1 files (50.0%) in 0.00031479994455973305 min\n",
      "15:38:17 INFO - Completed 2 files (100.0%) in 0.0003341992696126302 min\n",
      "15:38:17 INFO - done flushing in 5.7220458984375e-06 sec\n",
      "15:38:17 INFO - Completed execution in 0.0033513466517130536 min, execution result 0\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "LicenseSelect(\n",
    "        input_folder = \"./test-data/input\",\n",
    "        output_folder = \"output\",\n",
    "    ).transform()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c12bb468-e860-4a6a-b40d-9d9e0a03efdb",
   "metadata": {},
   "outputs": [],
   "source": [
    "***** Use python runtime to invoke the transform\n",
    "**** The specified folder will include the transformed parquet files."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f1bd4bf1",
   "metadata": {},
   "outputs": [],
   "source": [
    "import glob\n",
    "glob.glob(\"output/*\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
